﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SIA.HwAccess;

namespace SIA.Utility.HwCounter
{
    public enum eCounterType { NONE, UP, DOWN, UP_DOW }


    public delegate void dHwCounterEvent(IHwCounter hwCounter);

    public interface IHwCounter : IHwResource 
    {
        /// <summary>Valore di Conteggio</summary>
        long Value { get; set; }
        /// <summary>Segnale di riferimento</summary>
        IHwSignal UpHwSignal { get; }
        /// <summary>Abilitazinoe al conteggio</summary>
        Boolean Enable { get; set; }
        /// <summary>Tipo di Contatore</summary>
        eCounterType CounterType { get; set; }
        /// <summary>Data Inizio Conteggio</summary>
        Nullable<DateTime> FirstIncDateTime { get; }
        /// <summary>Data Ultimo Conteggio</summary>
        Nullable<DateTime> LastIncDateTime { get; }
        /// <summary>Data Inizio Conteggio</summary>
        Nullable<DateTime> FirstDecDateTime { get; }
        /// <summary>Data Ultimo Conteggio</summary>
        Nullable<DateTime> LastDecDateTime { get; }
        /// <summary>Valore di soglia superiore per l'evento</summary>
        long UpThreshold { get; set; }
        /// <summary>Valore di soglia inferiore per l'evento</summary>
        long DownThreshold { get; set; }

        /// <summary>decreases one unit</summary>
        void decreases();
        void decreases(int value);

        /// <summary>increases one unit</summary>
        void increases();
        void increases(int value);

        /// <summary>Evento raggiunto lo zero</summary>
        event dHwCounterEvent ReachedZero;
        /// <summary>Evento data change</summary>
        event dHwCounterEvent DataChange;
        /// <summary>Evento raggiunta la soglia</summary>
        event dHwCounterEvent ReachedUpThreshold;
        /// <summary>Evento raggiunta la soglia</summary>
        event dHwCounterEvent ReachedDownThreshold;
    }
}
